* Wealth index calculation. Genevieve Dupuis, 09/28/2016. Madagascar MIS 2016. cd 'C:\md71\Wealth'. include file='C:\md71\Wealth\wealth_assets.sps'. missing values QH118 (99.9). execute. set tvars=both. * Macro definitions to perform some recoding automatically. * Note: Do not use an asterisk in front of a macro name to try to comment it out - it will run any way because of the way the macros are expanded. * Delete the line instead or change the spelling of the macro in the comment. * Do not use the names of macros in comments - they will also be expanded too, and likely will fail. *{Create binary variables based on condition and give label }. define dichotomize( !positional !enclose('(',')') / !positional !tokens(1) / !positional !tokens(1) ) compute !2=0. if (!1) !2=1. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *(Separate shared toilets from non-shared toilets). define shared_fac( !positional !tokens(1) / !positional !tokens(1) / !positional !tokens(1) ). compute !2 = 0. do if (QH110=1). + if (!1=1) !2 = 1. + compute !1 = 0. end if. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *{Reset missing values to 'does not have', change 2 code to 0}. define no2zero( !positional !tokens(1) ) if (missing(!1) | !1<>1) !1=0. value labels !1 0 'No' 1 'Yes'. !enddefine. *{Construct Variables}. * Source of drinking water. dichotomize (QH101=11) QH101_11 "Source of drinking water: Robinet dans le logement". dichotomize (QH101=12) QH101_12 "Source of drinking water: Robinet dans la cour/parcelle". dichotomize (QH101=13) QH101_13 "Source of drinking water: Robinet chez le voisin". dichotomize (QH101=14) QH101_14 "Source of drinking water: Robinet public/borne fontaine". dichotomize (QH101=21) QH101_21 "Source of drinking water: Puits à pompe ou forage". dichotomize (QH101=31) QH101_31 "Source of drinking water: Puits protégés". dichotomize (QH101=32) QH101_32 "Source of drinking water: Puits non protégés". dichotomize (QH101=41) QH101_41 "Source of drinking water: Source protégée". dichotomize (QH101=42) QH101_42 "Source of drinking water: Source non protégée". *ichotomize (QH101=51) QH101_51 "Source of drinking water: Eau de pluie". *ichotomize (QH101=61) QH101_61 "Source of drinking water: Camion citerne". dichotomize (QH101=71 or QH101=61) QH101_71 "Source of drinking water: Charette avec petite citerne/tonneau/camion citerne". dichotomize (QH101=81) QH101_81 "Source of drinking water: Eau de surface (Rivière/barrage/Lac/Maré/Fleuve/Canal/Canal d'irrigation)". *ichotomize (QH101=91) QH101_91 "Source of drinking water: Eau en bouteille". dichotomize (QH101=96 or QH101=51) QH101_96 "Source of drinking water: Autre (including rain water)". * Type of toilet facility. dichotomize (QH109=11) QH109_11 "Type of toilet facility: Chasse d'eau - à un système d'égout". dichotomize (QH109=12) QH109_12 "Type of toilet facility: Chasse d'eau - à une fosse septique". dichotomize (QH109=13) QH109_13 "Type of toilet facility: Chasse d'eau - fosse d'aisance". dichotomize (QH109=14 or QH109=15) QH109_14 "Type of toilet facility: Chasse d'eau - à quelque chose d'autre/ne sait pas". *ichotomize (QH109=15) QH109_15 "Type of toilet facility: Chasse d'eau - ne sait pas". dichotomize (QH109=21) QH109_21 "Type of toilet facility: Fosses/latrines - ventilées ameliorées (VIP)". dichotomize (QH109=22) QH109_22 "Type of toilet facility: Fosses/latrines - avec dalles". dichotomize (QH109=23) QH109_23 "Type of toilet facility: Fosses/latrines - sans dalles/trou ouvert". dichotomize (QH109=31) QH109_31 "Type of toilet facility: Toilettes à compostage". dichotomize (QH109=41) QH109_41 "Type of toilet facility: Seau/tinette". dichotomize (QH109=51) QH109_51 "Type of toilet facility: Toilettes /latrines suspendues". dichotomize (QH109=61) QH109_61 "Type of toilet facility: Pas de toilette/nature". *ichotomize (QH109=96) QH109_96 "Type of toilet facility: Autre". shared_fac QH109_11 QH109_11_sh "Type of toilet facility: Chasse d'eau - à un système d'égout - shared". shared_fac QH109_12 QH109_12_sh "Type of toilet facility: Chasse d'eau - à une fosse septique - shared". shared_fac QH109_13 QH109_13_sh "Type of toilet facility: Chasse d'eau - fosse d'aisance - shared". shared_fac QH109_14 QH109_14_sh "Type of toilet facility: Chasse d'eau - à quelque chose d'autre/ne sait pas - shared". *hared_fac QH109_15 QH109_15_sh "Type of toilet facility: Chasse d'eau - ne sait pas - shared". shared_fac QH109_21 QH109_21_sh "Type of toilet facility: Fosses/latrines - ventilées ameliorées (VIP) - shared". shared_fac QH109_22 QH109_22_sh "Type of toilet facility: Fosses/latrines - avec dalles - shared". shared_fac QH109_23 QH109_23_sh "Type of toilet facility: Fosses/latrines - sans dalles/trou ouvert - shared". shared_fac QH109_31 QH109_31_sh "Type of toilet facility: Toilettes à compostage - shared". shared_fac QH109_41 QH109_41_sh "Type of toilet facility: Seau/tinette - shared". shared_fac QH109_51 QH109_51_sh "Type of toilet facility: Toilettes /latrines suspendues - shared". *hared_fac QH109_96 QH109_96_sh "Type of toilet facility: Autre - shared". * Type of cooking fuel. dichotomize (QH113=1) QH113_1 "Type of cooking fuel: ÉLECTRICITÉ". dichotomize (QH113=2 or QH113=3) QH113_2 "Type of cooking fuel: GAZ PROPANE LIQUÉFIÉ (GPL)/GAZ NATUREL". *ichotomize (QH113=3) QH113_3 "Type of cooking fuel: GAZ NATUREL". dichotomize (QH113=4) QH113_4 "Type of cooking fuel: BIOGAZ". *ichotomize (QH113=5) QH113_5 "Type of cooking fuel: KÉROSÈNE". dichotomize (QH113=6) QH113_6 "Type of cooking fuel: CHARBON, LIGNITE". dichotomize (QH113=7) QH113_7 "Type of cooking fuel: CHARBON DE BOIS". dichotomize (QH113=8) QH113_8 "Type of cooking fuel: BOIS". dichotomize (QH113=9) QH113_9 "Type of cooking fuel: PAILLE/BRANCHAGES/HERBES". dichotomize (QH113=10 or QH113=11) QH113_10 "Type of cooking fuel: RÉSIDUS AGRICOLES/BOUSE". *ichotomize (QH113=11) QH113_11 "Type of cooking fuel: BOUSE". dichotomize (QH113=95) QH113_95 "Type of cooking fuel: PAS DE REPAS PRÉPARÉ DANS LE MÉNAGE". *ichotomize (QH113=96) QH113_96 "Type of cooking fuel: AUTRE". * Cows/bulls. if (missing(QH116A) | QH115 <> 1) QH116A=0. missing values QH116A (99). compute QH116A_0 = (QH116A = 0). compute QH116A_1 = (QH116A >= 1 & QH116A <= 4). compute QH116A_2 = (QH116A >= 5 & QH116A <= 9). compute QH116A_3 = (QH116A >= 10 & QH116A <= 98). variable labels QH116A_0 'Cows/bulls: None' /QH116A_1 'Cows/bulls: 1-4' /QH116A_2 'Cows/bulls: 5-9' /QH116A_3 'Cows/bulls: 10+'. * Other cattle. if (missing(QH116B) | QH115 <> 1) QH116B=0. missing values QH116B (99). compute QH116B_0 = (QH116B = 0). compute QH116B_1 = (QH116B >= 1 & QH116B <= 4). compute QH116B_2 = (QH116B >= 5 & QH116B <= 9). compute QH116B_3 = (QH116B >= 10 & QH116B <= 98). variable labels QH116B_0 'Other cattle: None' /QH116B_1 'Other cattle: 1-4' /QH116B_2 'Other cattle: 5-9' /QH116B_3 'Other cattle: 10+'. * Horses/donkeys/mules. if (missing(QH116C) | QH115 <> 1) QH116C=0. missing values QH116C (99). compute QH116C_0 = (QH116C = 0). compute QH116C_1 = (QH116C >= 1 & QH116C <= 98). *compute QH116C_2 = (QH116C >= 5 & QH116C <= 9). *compute QH116C_3 = (QH116C >= 10 & QH116C <= 98). variable labels QH116C_0 'Horses/donkeys/mules: None' /QH116C_1 'Horses/donkeys/mules: 1+'. * Goats. if (missing(QH116D) | QH115 <> 1) QH116D=0. missing values QH116D (99). compute QH116D_0 = (QH116D = 0). compute QH116D_1 = (QH116D >= 1 & QH116D <= 4). compute QH116D_2 = (QH116D >= 5 & QH116D <= 9). compute QH116D_3 = (QH116D >= 10 & QH116D <= 98). variable labels QH116D_0 'Goats: None' /QH116D_1 'Goats: 1-4' /QH116D_2 'Goats: 5-9' /QH116D_3 'Goats: 10+'. * Sheep. if (missing(QH116E) | QH115 <> 1) QH116E=0. missing values QH116E (99). compute QH116E_0 = (QH116E = 0). compute QH116E_1 = (QH116E >= 1 & QH116E <= 4). compute QH116E_2 = (QH116E >= 5 & QH116E <= 9). compute QH116E_3 = (QH116E >= 10 & QH116E <= 98). variable labels QH116E_0 'Sheep: None' /QH116E_1 'Sheep: 1-4' /QH116E_2 'Sheep: 5-9' /QH116E_3 'Sheep: 10+'. * Chickens or other poultry. if (missing(QH116F) | QH115 <> 1) QH116F=0. missing values QH116F (99). compute QH116F_0 = (QH116F = 0). compute QH116F_1 = (QH116F >= 1 & QH116F <= 9). compute QH116F_2 = (QH116F >= 10 & QH116F <= 29). compute QH116F_3 = (QH116F >= 30 & QH116F <= 98). variable labels QH116F_0 'Chickens or other poultry: None' /QH116F_1 'Chickens or other poultry: 1-9' /QH116F_2 'Chickens or other poultry: 10-29' /QH116F_3 'Chickens or other poultry: 30+'. * Porcs. if (missing(QH116G) | QH115 <> 1) QH116G=0. missing values QH116G (99). compute QH116G_0 = (QH116G = 0). compute QH116G_1 = (QH116G >= 1 & QH116G <= 4). compute QH116G_2 = (QH116G >= 5 & QH116G <= 9). compute QH116G_3 = (QH116G >= 10 & QH116G <= 98). variable labels QH116G_0 'Porcs: None' /QH116G_1 'Porcs: 1-4' /QH116G_2 'Porcs: 5-9' /QH116G_3 'Porcs: 10+'. * Hectares for agricultural land. compute landarea = QH118. if (missing(QH118) | QH118 >= 99.8) landarea = 99.9. if (missing(QH117) | QH117 <> 1) landarea=0. missing values landarea (99.9). * Electricity. no2zero QH119A. * Radio. no2zero QH119B. * Television. no2zero QH119C. * Telephone (non-mobile). no2zero QH119D. * Computer. no2zero QH119E. * Refrigerator. no2zero QH119F. * Watch. no2zero QH120A. * Mobile telephone. no2zero QH120B. * Bicycle. no2zero QH120C. * Motorcycle or scooter. no2zero QH120D. * Animal-drawn cart. no2zero QH120E. * Car or Truck. no2zero QH120F. * Boat with a motor. no2zero QH120G. * Bank account. no2zero QH121. * Main floor material. dichotomize (QH148=11) QH148_11 "Main floor material: TERRE/SABLE". dichotomize (QH148=12) QH148_12 "Main floor material: BOUSE". dichotomize (QH148=21) QH148_21 "Main floor material: PLANCHES EN BOIS". dichotomize (QH148=22) QH148_22 "Main floor material: PALMES/BAMBOU". dichotomize (QH148=23) QH148_23 "Main floor material: NATTE". dichotomize (QH148=31) QH148_31 "Main floor material: PARQUET OU BOIS CIRÉ". dichotomize (QH148=32) QH148_32 "Main floor material: BANDES DE VINYLE/ ASPHALTE". dichotomize (QH148=33) QH148_33 "Main floor material: CARRELAGE/CARREAUX". dichotomize (QH148=34) QH148_34 "Main floor material: CIMENT". dichotomize (QH148=35) QH148_35 "Main floor material: MOQUETTE". dichotomize (QH148=96) QH148_96 "Main floor material: AUTRE". * Main roof material. *ichotomize (QH149=11) QH149_11 "Main roof material: PAS DE TOIT". dichotomize (QH149=12) QH149_12 "Main roof material: CHAUME/PALME/FEUILLES". dichotomize (QH149=13) QH149_13 "Main roof material: MOTTE DE TERRE". dichotomize (QH149=21) QH149_21 "Main roof material: NATTE". dichotomize (QH149=22) QH149_22 "Main roof material: PALME/BAMBOU". dichotomize (QH149=23) QH149_23 "Main roof material: PLANCHES EN BOIS". *ichotomize (QH149=24) QH149_24 "Main roof material: CARTON". dichotomize (QH149=31) QH149_31 "Main roof material: TÔLE". dichotomize (QH149=32) QH149_32 "Main roof material: BOIS". dichotomize (QH149=33) QH149_33 "Main roof material: ZINC/FIBRE DE CIMENT". dichotomize (QH149=34 or QH149=36) QH149_34 "Main roof material: TUILES/SHINGLES". dichotomize (QH149=35) QH149_35 "Main roof material: CIMENT". *ichotomize (QH149=36) QH149_36 "Main roof material: SHINGLES". dichotomize (QH149=96) QH149_96 "Main roof material: AUTRE". * Main wall material. *ichotomize (QH150=11) QH150_11 "Main wall material: PAS DE MUR". dichotomize (QH150=12) QH150_12 "Main wall material: BAMBOU/CANE/PALME/TRONC". dichotomize (QH150=13) QH150_13 "Main wall material: TERRE". dichotomize (QH150=21) QH150_21 "Main wall material: BAMBOU AVEC BOUE". dichotomize (QH150=22) QH150_22 "Main wall material: PIERRE AVEC BOUE". dichotomize (QH150=23) QH150_23 "Main wall material: ADOBE NON RECOUVERT". dichotomize (QH150=24 or QH150=25) QH150_24 "Main wall material: CONTRE-PLAQUÉ/CARTON". *ichotomize (QH150=25) QH150_25 "Main wall material: CARTON". dichotomize (QH150=26) QH150_26 "Main wall material: BOIS DE RÉCUPÉRATION". dichotomize (QH150=31) QH150_31 "Main wall material: CIMENT". dichotomize (QH150=32) QH150_32 "Main wall material: PIERRE AVEC CHAUX/CIMENT". dichotomize (QH150=33) QH150_33 "Main wall material: BRIQUES". dichotomize (QH150=34) QH150_34 "Main wall material: BLOCS DE CIMENT". dichotomize (QH150=35) QH150_35 "Main wall material: ADOBE RECOUVERT". dichotomize (QH150=36) QH150_36 "Main wall material: PLANCHE EN BOIS/SHINGLES". dichotomize (QH150=37) QH150_37 "Main wall material: TÔLE". dichotomize (QH150=96) QH150_96 "Main wall material: AUTRE". *{Members per sleeping room}. if (hhusual=0) hhusual=hhslept. if (QH114>0) memsleep=trunc(hhusual/QH114). if (QH114=0) memsleep=hhusual. if (missing(QH114) or QH114>=99 or memsleep>=98) memsleep=99. variable labels memsleep 'Number of members per sleeping room'. value labels memsleep 0 'Less than 1 per room'. formats memsleep (f2.0). missing values memsleep (99). * Compute urban and rural variables coded (1/0) for filters later. compute urban=(QHTYPE = 1). compute rural=(QHTYPE = 2). variable labels urban 'Urban' / rural 'Rural'. value labels urban 1 'Urban' / rural 1 'Rural'. formats urban rural (f1.0). execute. * Check on indicator variable creation. *frequencies variables=QHTYPE to domestic. * Toilet facility by shared/not shared. crosstabs /tables=QH109 by QH110. *dropped QH101_51, QH101_61, QH101_91,QH109_15, QH109_15_sh, QH109_96, QH109_96_sh, QH113_3, QH113_5, QH113_11, QH113_96, QH149_11. QH149_24, QH149_36, QH150_11, QH150_25, QH116C_2, QH116C_3. frequencies variables= QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea . * Turn off weights before all factor analysis. weight off. * Name the dataset window for the HH data for use later. dataset name assets. save outfile='assets.sav'. *** Test Factor Analysis. filter off. execute. *dropped QH101_51, QH101_61, QH101_91, QH109_15, QH109_15_sh, QH109_96, QH109_96_sh, QH113_3, QH113_5, QH113_11, QH113_96, QH149_11. QH149_24, QH149_36, QH150_11, QH150_25, QH116C_2, QH116C_3. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /method=correlation. *** Common Factor analysis ***. ** Removed area-specific variables **. ** Agricultural animal variables excluded ** Land area excluded ** Any others ?. *** Common Factor Analysis. filter off. execute. *dropped QH101_51, QH101_61, QH101_91, QH109_15, QH109_15_sh, QH109_96, QH109_96_sh, QH113_3, QH113_5, QH113_11, QH113_96, QH149_11. QH149_24, QH149_36, QH150_11, QH150_25. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL com) /method=correlation. *** Urban Factor Analysis. filter off. filter by urban. execute. *dropped QH101_51, QH101_61, QH101_91, QH109_15, QH109_15_sh, QH109_96, QH109_96_sh, QH113_3, QH113_5, QH113_11, QH113_96, QH149_11. QH149_24, QH149_36, QH150_11, QH150_25, QH116C_2, QH116C_3. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL urb) /method=correlation. *** Rural Factor Analysis. filter off. filter by rural. execute. *dropped QH101_51, QH101_61, QH101_91, QH109_15, QH109_15_sh, QH109_96, QH109_96_sh, QH113_3, QH113_5, QH113_11, QH113_96, QH149_11. QH149_24, QH149_36, QH150_11, QH150_25, QH116C_2, QH116C_3. factor /variables QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL rur) /method=correlation. * Label the created score variables. rename variables (com1 urb1 rur1=comscore urbscore rurscore). variable labels comscore 'Common wealth score' /urbscore 'Urban wealth score' /rurscore 'Rural wealth score'. * Add a variable used for linking later. filter off. string rowtype_ (A8). compute rowtype_ = 'EST'. * Calculate regressions. ** Area=urban. filter off. filter by urban. execute. * Declare a dataset to be written to in the regression. dataset declare urbancorv. * Run regression of comscore with urbscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter urbscore /outfile=corv(urbancorv). * Activate file of output from regression. dataset activate urbancorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=urbconst urbscore=urbcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = urbancorv /by ROWTYPE_. execute. * Calculate regressions. ** Area=rural. filter off. filter by rural. execute. * Declare a dataset to be written to in the regression. dataset declare ruralcorv. * Run regression of comscore with rurscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter rurscore /outfile=corv(ruralcorv). * Activate file of output from regression. dataset activate ruralcorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=rurconst rurscore=rurcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = ruralcorv /by ROWTYPE_. execute. dataset close urbancorv. dataset close ruralcorv. dataset activate assets. filter off. *** Calculate combined wealth score from Urban and Rural Scores. * Use coefficients from urban and rural regressions above. compute combscor=0. print formats combscor (f11.5). write formats combscor (f11.5). ** Urban. if (urban = 1) combscor=urbconst+urbcoeff*urbscore. ** Rural. if (rural = 1) combscor=rurconst+rurcoeff*rurscore. variable labels combscor 'Combined national wealth score'. execute. compute hhwt = QHWEIGHT/1000000. variable labels hhwt 'HH weights'. weight by hhwt. filter off. execute. frequencies variables=combscor comscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. filter by urban. execute. frequencies variables=combscor urbscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. filter by rural. execute. frequencies variables=combscor rurscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. execute. *Calculate quintiles and scores for data file. compute hhmemwt=QHWEIGHT*hhusual/1000000. weight by hhmemwt. variable labels hhmemwt 'HH members weighting for index'. filter off. filter by urban. execute. rank variables=urbscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. filter by rural. execute. rank variables=rurscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. execute. rank variables=combscor (A) /rank /ntiles (5) /print=yes /ties=mean. variable labels ncombsco 'Combined wealth index' /nurbscor 'Urban wealth index' /nrurscor 'Rural wealth index'. value labels ncombsco nurbscor nrurscor 1 'Lowest' 2 'Second' 3 'Middle' 4 'Fourth' 5 'Highest'. *** Check on quintiles. frequencies variables=ncombsco nurbscor nrurscor. weight by hhwt. *dropped QH101_51, QH101_61, QH101_91, QH109_15, QH109_15_sh, QH109_96, QH109_96_sh, QH113_3, QH113_5, QH113_11, QH113_96, QH149_11. QH149_24, QH149_36, QH150_11, QH150_25, QH116C_2, QH116C_3. ctables /table ( QH101_11+QH101_12+QH101_13+QH101_14+QH101_21+QH101_31+QH101_32+QH101_41+QH101_42+QH101_71+QH101_81+QH101_96+ QH109_11+QH109_12+QH109_13+QH109_14+QH109_21+QH109_22+QH109_23+QH109_31+QH109_41+QH109_51+QH109_61+ QH109_11_sh+QH109_12_sh+QH109_13_sh+QH109_14_sh+QH109_21_sh+QH109_22_sh+QH109_23_sh+QH109_31_sh+QH109_41_sh+QH109_51_sh+ QH113_1+QH113_2+QH113_4+QH113_6+QH113_7+QH113_8+QH113_9+QH113_10+QH113_95+ QH119A+QH119B+QH119C+QH119D+QH119E+QH119F+QH120A+QH120B+QH120C+QH120D+QH120E+QH120F+QH120G+QH121+ QH148_11+QH148_12+QH148_21+QH148_22+QH148_23+QH148_31+QH148_32+QH148_33+QH148_34+QH148_35+QH148_96+ QH149_12+QH149_13+QH149_21+QH149_22+QH149_23+QH149_31+QH149_32+QH149_33+QH149_34+QH149_35+QH149_96+ QH150_12+QH150_13+QH150_21+QH150_22+QH150_23+QH150_24+QH150_26+QH150_31+QH150_32+QH150_33+QH150_34+QH150_35+QH150_36+QH150_37+QH150_96+ LAND+memsleep+ QH116A_0+QH116A_1+QH116A_2+QH116A_3+QH116B_0+QH116B_1+QH116B_2+QH116B_3+ QH116C_0+QH116C_1+QH116D_0+QH116D_1+QH116D_2+QH116D_3+ QH116E_0+QH116E_1+QH116E_2+QH116E_3+QH116F_0+QH116F_1+QH116F_2+QH116F_3+ QH116G_0+QH116G_1+QH116G_2+QH116G_3+landarea )[S][Mean F8.3] by (ncombsco+nurbscor+nrurscor)[C] /slabels visible=no. * Alternative instead of ctables. *means tables= QH101_11 QH101_12 QH101_13 QH101_14 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_71 QH101_81 QH101_96 QH109_11 QH109_12 QH109_13 QH109_14 QH109_21 QH109_22 QH109_23 QH109_31 QH109_41 QH109_51 QH109_61 QH109_11_sh QH109_12_sh QH109_13_sh QH109_14_sh QH109_21_sh QH109_22_sh QH109_23_sh QH109_31_sh QH109_41_sh QH109_51_sh QH113_1 QH113_2 QH113_4 QH113_6 QH113_7 QH113_8 QH113_9 QH113_10 QH113_95 QH119A QH119B QH119C QH119D QH119E QH119F QH120A QH120B QH120C QH120D QH120E QH120F QH120G QH121 QH148_11 QH148_12 QH148_21 QH148_22 QH148_23 QH148_31 QH148_32 QH148_33 QH148_34 QH148_35 QH148_96 QH149_12 QH149_13 QH149_21 QH149_22 QH149_23 QH149_31 QH149_32 QH149_33 QH149_34 QH149_35 QH149_96 QH150_12 QH150_13 QH150_21 QH150_22 QH150_23 QH150_24 QH150_26 QH150_31 QH150_32 QH150_33 QH150_34 QH150_35 QH150_36 QH150_37 QH150_96 LAND memsleep QH116A_0 QH116A_1 QH116A_2 QH116A_3 QH116B_0 QH116B_1 QH116B_2 QH116B_3 QH116C_0 QH116C_1 QH116D_0 QH116D_1 QH116D_2 QH116D_3 QH116E_0 QH116E_1 QH116E_2 QH116E_3 QH116F_0 QH116F_1 QH116F_2 QH116F_3 QH116G_0 QH116G_1 QH116G_2 QH116G_3 landarea by ncombsco nurbscor nrurscor /cells mean count stddev. graph /histogram(normal)=combscor /title= 'Distribution of Households by Wealth Scores'. frequencies variables=combscor /format=notable /ntiles=5 /statistics=stddev minimum maximum semean mean median mode skewness seskew kurtosis sekurt /order=analysis. weight off. filter off. write formats combscor urbscore rurscore (f11.5). * Save final dataset of assets. save outfile='assets.sav'. *** Write out scores file. write outfile='scores.dat' table /QHCLUST QHNUMBER combscor ncombsco urbscore nurbscor rurscore nrurscor. execute. weight by hhmemwt. compute total = 0. ctables /vlabels variables=QHTYPE QHREGION total Ncombsco DISPLAY=BOTH /table QHTYPE [C] + QHREGION [C] + total [C] BY Ncombsco [C][ROWPCT.COUNT '' F8.1] + total [C][ROWPCT.COUNT '' F8.1, COUNT '' F8.0] /titles title='Table 2.5 Wealth Quintiles' '' 'Percent distribution of the de jure population by wealth quintiles, according to residence and region, Madagascar MIS 2016' corner='Residence/region' /slabels visible=no.